// 文章分类管理
import {request} from '../utils/request'
// const ARTICLE_URL = 'http://dev.content.lbs.p.yufeiworld.com/'
// const ARTICLE_URL = 'http://dev.gateway.lbs.p.yufeiworld.com'
const ARTICLE_URL = ''

// 删除分类
export const requestArticleCategoryDel = (delId : {id: number}) => {
	return request({
		url: ARTICLE_URL + `/admin/content/category/delete`,
		method: "POST",
		data: delId,
		header: {
			'content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
		}
	})
}

// 分类详情
export const requestArticleCategoryGet = (getId : {id: number}) => {
	return request({
		url: ARTICLE_URL + `/admin/content/category/get`,
		method: "GET",
		data: getId,
		header: {
			'content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
		}
	})
}

export type CategoryInfo = {
	categoryName: string,
	categoryStatus: number,
	id: number,
	sort: number
}
// 新增分类
export const requestArticleCategoryInsert = (categoryInfo: CategoryInfo) => {
	return request({
		url: ARTICLE_URL + `/admin/content/category/insert`,
		method: "POST",
		data: categoryInfo,
		header: {
			'content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
		}
	})
}

export type CategoryListInfo = {
	categoryName: string,
	categoryStatus: number,
	page: number,
	pageSize: number
}
// 获取分类列表
export const requestArticleCategoryList = (categoryListInfo: CategoryListInfo) => {
	return request({
		url: ARTICLE_URL + `/admin/content/category/list`,
		method: "GET",
		data: categoryListInfo,
		header: {
			'content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
		}
	})
}

// 更新分类
export const requestArticleCategoryUpdate = (categoryInfo: CategoryInfo) => {
	return request({
		url: ARTICLE_URL + `/admin/content/category/update`,
		method: "POST",
		data: categoryInfo,
		header: {
			'content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
		}
	})
}